function url(p) {
  return `${window.RPConfig.mgt}/template/${p}`;
  // return `/template/${p}`;
  // return `http://yapi.dev.crc.com.cn/mock/96/template/${p}`;
}

// 获取拓展属性模板
export const getExtendAttrList = ({ responseProcess, param, initParam }) => {
  const condition = initParam;
  const _param = { ...param, condition };
  $http.post(url("list/page"), _param).then(res => {
    responseProcess(res.data);
  });
};

// 列表
export const getTemplateList = param => $http.post(url("list"), param);

// 新增模板
export const addTemplate = param => $http.post(url(param.id ? "update" : "add"), param);
// 根据模板id获取模板
export const templateDetail = id => $http.post(url("detail?templateId=" + id));

// 新增模板
export const deleteTemplate = param => $http.post(url("delete"), param);
// 升级模板
export const upgradeTemplate = param => $http.post(url("upgrade"), param);
// 发布模板
// export const publishTemplate = id => $http.post(url("publish?templateId=" + id));
export const publishTemplate = param => $http.post(url("publish"), param);
// 获取公司模板
export const getCompanyTemplateList = statusList =>
  $http.get(url("getAttributeTemplateListByStatusAndName?templateCategory=COMPANY&statusList=" + statusList));
// 获取部门模板
export const getDepartmentTemplateList = statusList =>
  $http.get(url("getAttributeTemplateListByStatusAndName?templateCategory=DEPARTMENT&statusList=" + statusList));
// 获取值集模板列表
export const getValueSetTemplateList = statusList =>
  $http.get(url("getAttributeTemplateListByStatusAndName?templateCategory=VALUE_SET&statusList=" + statusList));

// 复制模板
export const getCopyTemplate = id => $http.post(url("duplicate?templateId=" + id));

 